/**
 * 部门添加js
 */
var comValidform=null;
var returnStatus=false;
var userChannelUpdate={
	dataCache:null,
		
	startEvent:function(){
		comValidform=$(".com-addForm").Validform({
			tiptype:2,
			tipSweep:true,
			beforeSubmit:function(curform){
				var url = 'mgr/userChannelCtrl/update';
				var params = jsUtils.serializeJson($('.com-addForm'));
				var cb = function(data){
					alert(data.msg);
					//成功返回
					if(data.resultCode==200){
						//关闭窗口并刷新数据
						art.dialog.close();
						returnStatus=true;
					}
				};
				sendApiNoLoadSync(url, params, cb, 'POST');
				return false;
			}
		});
	},
	
	init:function(){
		$("input[name='id']").val(art.dialog.data('id'));
		$("input[name='name']").val(art.dialog.data('name'));
		$("input[name='companyDes']").val(art.dialog.data('companyDes'));
		
		var companyType = art.dialog.data('companyType');
		
		$(".selector").find("option[value='" + companyType + "']").attr("selected",true);
		
		userChannelUpdate.startEvent();
	}
}
$(document).ready(function() {
	userChannelUpdate.init();
});
function submitForm(){
	comValidform.submitForm();
	return returnStatus;
}